]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
boxpointer: Use the -arrow-rise as padding instead of a magic number
authorDebarshi Ray <debarshir@gnome.org>
Fri, 31 Aug 2012 22:49:14 +0000 (00:49 +0200)
committerDebarshi Ray <debarshir@gnome.org>
Sat, 1 Sep 2012 11:14:45 +0000 (13:14 +0200)
This makes sense if we want to follow what the following comment says:
// We also want to keep it onscreen, and separated from the
// edge by the same distance as the main part of the box is
// separated from its sourceActor

Using a magic number violates the "separated from the edge ...
separated from its sourceActor" part.

https://bugzilla.gnome.org/show_bug.cgi?id=682343

js/ui/boxpointer.js

index 03d114bac0a0c06ac24a56b1a229061741a1aee7..17c18016e1c4c907914f2983c39d42d2b38aaba5 100644 (file)
@@ -410,6 +410,7 @@ const BoxPointer = new Lang.Class({
 
         let themeNode = this.actor.get_theme_node();
         let gap = themeNode.get_length('-boxpointer-gap');
+        let padding = themeNode.get_length('-arrow-rise');
 
         let resX, resY;
 
@@ -435,8 +436,8 @@ const BoxPointer = new Lang.Class({
         case St.Side.BOTTOM:
             resX = sourceCenterX - (halfMargin + (natWidth - margin) * alignment);
 
-            resX = Math.max(resX, monitor.x + 10);
-            resX = Math.min(resX, monitor.x + monitor.width - (10 + natWidth));
+            resX = Math.max(resX, monitor.x + padding);
+            resX = Math.min(resX, monitor.x + monitor.width - (padding + natWidth));
             this.setArrowOrigin(sourceCenterX - resX);
             break;
 
@@ -444,8 +445,8 @@ const BoxPointer = new Lang.Class({
         case St.Side.RIGHT:
             resY = sourceCenterY - (halfMargin + (natHeight - margin) * alignment);
 
-            resY = Math.max(resY, monitor.y + 10);
-            resY = Math.min(resY, monitor.y + monitor.height - (10 + natHeight));
+            resY = Math.max(resY, monitor.y + padding);
+            resY = Math.min(resY, monitor.y + monitor.height - (padding + natHeight));
 
             this.setArrowOrigin(sourceCenterY - resY);
             break;